![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@smithy/middleware-content-length
Advanced tools
[![NPM version](https://img.shields.io/npm/v/@smithy/middleware-content-length/latest.svg)](https://www.npmjs.com/package/@smithy/middleware-content-length) [![NPM downloads](https://img.shields.io/npm/dm/@smithy/middleware-content-length.svg)](https://ww
@smithy/middleware-content-length is a middleware package for the Smithy client framework. It is used to automatically calculate and set the Content-Length header for HTTP requests. This is particularly useful when dealing with payloads where the size needs to be explicitly defined.
Automatic Content-Length Calculation
This feature automatically calculates the Content-Length of the request body and sets it in the HTTP headers. This is useful for ensuring that the server knows the size of the incoming request payload.
const { ContentLengthMiddleware } = require('@smithy/middleware-content-length');
const { HttpRequest } = require('@smithy/protocol-http');
const request = new HttpRequest({
hostname: 'example.com',
method: 'POST',
body: JSON.stringify({ key: 'value' })
});
const middleware = ContentLengthMiddleware();
const handler = middleware((next) => async (args) => {
return next(args);
});
handler({ request }).then((response) => {
console.log(response.request.headers['Content-Length']); // Outputs the calculated Content-Length
});
Axios is a popular HTTP client for Node.js and the browser. It automatically sets the Content-Length header for POST requests with a body. However, it is a full-fledged HTTP client and not just middleware.
The request package is another HTTP client for Node.js that automatically handles the Content-Length header for requests with a body. Like axios, it is a complete HTTP client and not just middleware.
Node-fetch is a lightweight module that brings window.fetch to Node.js. It also automatically sets the Content-Length header for requests with a body. It is more lightweight compared to axios and request.
FAQs
[![NPM version](https://img.shields.io/npm/v/@smithy/middleware-content-length/latest.svg)](https://www.npmjs.com/package/@smithy/middleware-content-length) [![NPM downloads](https://img.shields.io/npm/dm/@smithy/middleware-content-length.svg)](https://ww
The npm package @smithy/middleware-content-length receives a total of 15,498,056 weekly downloads. As such, @smithy/middleware-content-length popularity was classified as popular.
We found that @smithy/middleware-content-length demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.